<?php
    // 文章详情
	session_start(); //开启session
    $user=isset($_SESSION['user'])?$_SESSION['user']:false; //判断session是否存在       
	$aid=(int)$_GET['aid']; //文章id
	// 连接数据库
    require_once $_SERVER['DOCUMENT_ROOT'].'/blog/lib/Db.php'; //绝对地址
    $db=new Db();
    // 博客分类
    $cates=$db->table('cates')->lists();
    // 查询文章数据
    $article=$db->table('article')->where(array('id'=>$aid))->item();
    include_once './template/header.php';
    include_once './template/topnav.php';
?>
    <link rel="stylesheet" href="static/css/site.css">
    <!-- 内容区 -->
    <div class="main container">
        <?php include_once './template/classify.php'?>

        <div class="col-lg-10 col-md-10 col-sm-10">
            <div class="nav">
                <a href="" class="active">最新</a>
                <a href="">热门</a>
            </div>

            <div class="content-list d-cnt">
                <h3 class="d-title"><?php echo $article['title']?></h3>
                <p class="d-time">发布时间：<?php echo date('Y-m-d H:i:s',$article['add_time'])?></p>
                <hr>
                <div class="contents">
                	<?php echo htmlspecialchars_decode($article['contents'])?>
                </div>
            </div>
        </div>
    </div>
    <?php include_once './template/footer.php'?>
    